package models

import (
	"demo/device-hub/constants/types"
	"github.com/go-courier/geography"
)

//go:generate tools gen model2 Device --database DBVideoHub --with-comments
// 设备信息表
// @def primary ID
// @def unique_index uk_device_id DeviceID
// @def unique_index uk_origin_id OriginalID
type Device struct {
	PrimaryID
	RefDeviceID
	RefDeviceInfo
	OperationTimesWithDeletedAt
}

type DeviceID = SFID

type RefDeviceID struct {
	// @rel Device.DeviceID
	// 设备ID
	DeviceID DeviceID `db:"f_device_id" json:"deviceID,omitempty"`
}

type RefDeviceInfo struct {
	RefPlatformID
	// 原始ID
	OriginalID string `db:"f_original_id" json:"original_id"`
	// 设备名称
	Name string `db:"f_name,default=''" json:"name,omitempty"`
	// 设备类型
	Type types.DeviceType `db:"f_type,default='1'" json:"type"`
	// 设备地址
	Address string `db:"f_address" json:"address"`
	// 地理坐标
	Point geography.Point `db:"f_point" json:"point"`
}
